package com.grupit.module.user.web.gwt.client.pluggablefeatures.agent.useraction;

import com.grupit.api.core.control.ioc.GrupitClientFactory;
import com.grupit.api.core.ui.pluggablefeatures.tools.IsAgentForUserAction;
import com.grupit.api.core.ui.pluggablefeatures.tools.PluggableFeatureAgent;
import com.grupit.module.user.web.gwt.client.pluggablefeatures.activity.NoteBoardActivity;
import com.seleniti.pozit.client.ioc.impl.GrupitPozitClientFactoryDesktopImpl;
import com.seleniti.pozit.controller.ui.base.PoZitBasePresenter;

@IsAgentForUserAction(userActionId = "ToNoteBoard")
public class ToNoteBoardUserActionAgent implements PluggableFeatureAgent {
	private NoteBoardActivity noteBoardActivity;

	@Override
	public void init(GrupitClientFactory grupitClientFactory) {
		GrupitPozitClientFactoryDesktopImpl poZitClientFactory = new GrupitPozitClientFactoryDesktopImpl(grupitClientFactory);
		PoZitBasePresenter.setClientFactory(poZitClientFactory);
	}

	@Override
	public NoteBoardActivity getActivity() {
		if (this.noteBoardActivity == null) {
			this.noteBoardActivity = new NoteBoardActivity();
		}
		return noteBoardActivity;
	}
}
